package com.brokendust.client.config.module.util;

import com.brokendust.client.manager.ClientManager;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.util.HashMap;
import java.util.Map;

public class InputJson {
    private String gui_id;
    private String button_id;
    private String message;
    private Map<String, String> message_map;

    public InputJson() {
        this.gui_id = "";
        this.button_id = "";
        this.message = "";
        this.message_map = new HashMap<String, String>();
    }

    public InputJson(String button_id, String message) {
        this.gui_id = "";
        this.button_id = "";
        this.message = "";
        this.message_map = new HashMap<String, String>();
        this.gui_id = ClientManager.menu.menu_name;
        this.button_id = button_id;
        this.message = message;
    }

    public InputJson(String button_id, String message, Map<String, String> message_map) {
        this.gui_id = "";
        this.button_id = "";
        this.message = "";
        this.message_map = new HashMap<String, String>();
        this.button_id = button_id;
        this.message = message;
        this.message_map = message_map;
    }

    public static InputJson readJSON(String string) {
        GsonBuilder builder = new GsonBuilder();
        Gson gson = builder.create();
        return gson.fromJson(string, InputJson.class);
    }

    public void addMessage(String button_id, String message) {
        this.message_map.put(button_id, message);
    }

    public String getButton_id() {
        return this.button_id;
    }

    public void setButton_id(String button_id) {
        this.button_id = button_id;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Map<String, String> getMessage_map() {
        return this.message_map;
    }

    public void setMessage_map(Map<String, String> message_map) {
        this.message_map = message_map;
    }

    public String getGui_id() {
        return this.gui_id;
    }

    public void setGui_id(String gui_id) {
        this.gui_id = gui_id;
    }
}
